package cn.itheima.exception;

import cn.itheima.pojo.Result;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import javax.validation.ConstraintViolationException;

/**
 * @author 董代恒
 * @version 1.0
 * 全局异常处理器
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(ConstraintViolationException.class)
    public Result HandleException(ConstraintViolationException e) {
        e.printStackTrace();
        return Result.error("用户名或者密码格式不正确");
    }
}
